// *************************************************************************************************
//
// MK3D Engine
// --------------------------------------
// Copyright (C) 2007-2011 Zeb (mailto: zebbey@gmail.com)
//
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//
// *************************************************************************************************

#ifndef __H_MK_D3D9_RENDER_INPUT__
#define __H_MK_D3D9_RENDER_INPUT__

#include "mk_render_input.h"

namespace MK3DE
{
	const DWORD MAX_RENDER_INPUT_ELEM_NUM = 32;

	class CD3D9RenderInput : public CRenderInput
	{
	public:
		CD3D9RenderInput();
		~CD3D9RenderInput();

		BOOL Create(RenderInputElemDesc* desc, DWORD descNum);

		LPDIRECT3DVERTEXDECLARATION9 GetD3D9VertexDeclaration() { return _d3d9VertexDeclaration; }

		BOOL BindVertexBuffer(LPDIRECT3DDEVICE9 pdevice);
		BOOL BindIndexBuffer(LPDIRECT3DDEVICE9 pdevice, BOOL& bIndex);

	private:
		BOOL __MapRenderInputElemDesc(D3DVERTEXELEMENT9* pd3delem, RenderInputElemDesc* elem);

	private:
		LPDIRECT3DVERTEXDECLARATION9    _d3d9VertexDeclaration;
	};

};

#endif // __H_MK_D3D9_RENDER_INPUT__